Public Class ParentForm
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub
    Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
    Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
    Friend WithEvents tileVerticalMenuItem As System.Windows.Forms.MenuItem

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.Container

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.MainMenu1 = New System.Windows.Forms.MainMenu()
        Me.MenuItem1 = New System.Windows.Forms.MenuItem()
        Me.tileVerticalMenuItem = New System.Windows.Forms.MenuItem()
        '
        'MainMenu1
        '
        Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1})
        '
        'MenuItem1
        '
        Me.MenuItem1.Index = 0
        Me.MenuItem1.MdiList = True
        Me.MenuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.tileVerticalMenuItem})
        Me.MenuItem1.Text = "Windows"
        '
        'tileVerticalMenuItem
        '
        Me.tileVerticalMenuItem.Index = 0
        Me.tileVerticalMenuItem.Text = "Tile Vertical"
        '
        'ParentForm
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(292, 266)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {New System.Windows.Forms.MdiClient()})
        Me.IsMdiContainer = True
        Me.Menu = Me.MainMenu1
        Me.Name = "ParentForm"
        Me.Text = "MDI Demo"

    End Sub

#End Region
    ' Declare child forms of type ChildForm
    Private WithEvents FirstChild As ChildForm
    Private WithEvents SecondChild As ChildForm

    Private Sub ParentForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ' Instantiate an Object of type Childform
        FirstChild = New ChildForm()
        ' Make this form the MDI Parent of FirstChild
        FirstChild.MdiParent = Me
        FirstChild.Text = "First Child Form"  ' Set Caption
        ' Show FirstChild 
        FirstChild.Show()

        ' Instantiate the second Object of type Childform
        SecondChild = New ChildForm()
        ' Make this form the MDI Parent of FirstChild
        SecondChild.MdiParent = Me
        SecondChild.Text = "Second Child Form" ' Set Caption
        ' Show SecondChild 
        SecondChild.Show()

    End Sub

    Private Sub tileVerticalMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tileVerticalMenuItem.Click
        Me.LayoutMdi(System.Windows.Forms.MdiLayout.TileVertical)
    End Sub
End Class
